package com.easyjava.builder;

import com.easyjava.bean.Constants;
import com.easyjava.bean.TableInfo;
import com.easyjava.utils.DateUtils;

import java.io.BufferedWriter;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @ClassName: BuildComment
 * @Description: 生成类注释
 * @Version: V1.0.0
 * @Author: LaiAnda
 * @Date: 2025/7/30 10:07
 */
public class BuildComment {
    public static void createClassComment (BufferedWriter bw, TableInfo tableInfo) throws Exception {
        bw.write("/**");
        bw.newLine();
        bw.write(" * @ClassName: " + tableInfo.getBeanName());
        bw.newLine();
        bw.write(" * @Description: TODO" + tableInfo.getComment());
        bw.newLine();
        bw.write(" * @Version: " + Constants.VERSION_COMMENT);
        bw.newLine();
        bw.write(" * @Author: " + Constants.AUTHOR_NAME);
        bw.newLine();
        bw.write(" * @Date: " + DateUtils.format(new Date(), DateUtils._YYYYMMDD));
        bw.newLine();
        bw.write(" */");
        bw.newLine();
    }

    public static void createFieldComment (BufferedWriter bw, String fieldComment) throws Exception {
        bw.write("\t/**");
        bw.newLine();
        bw.write("\t * " + (fieldComment==null ? "" : fieldComment));
        bw.newLine();
        bw.write("\t */");
        bw.newLine();
    }

    public static void createMathodComment () {

    }
}